run scrips in non graphic mode

I have about 5000 models that I need to export as GLB/GLBF files. More files will come in the near future.
My idea was to phyton script this action BUT can I have that run in the background under a separate licence (for sure on an stand alone computer)? Best practice would be an integration with our file server to automate the whole process from STEP to KS to GLB/GLBF

Personally I prefer to use the KS Web Viewer but this is not an option for leading project team.
Thank you in advance for any hints, help, ideas etc.

I’ve no experience with scripts but you’re looking for the ‘headless’ mode. So I think it’s possible, here is some documentation: KeyShot 2023.2 Headless Scripting Documentation

Hi @oscar.rottink I locked there before but I cannot see any references to a file server integration to run a python script.

What I think you have to do (with my limited programming knowledge) is basically the following:

  • get the list of file names from a certain location using default Python commands and put them in an array, you should also be able to get them from a network drive if needed if you can also see those files from your machine
  • loop through that array in the ‘normal’ Python way and use the special KeyShot python commands to do the actual conversion and export

So you install Python on the machine you want to use, KeyShot will automatically see it’s installed and you combine basic Python functions with the ones from the KeyShot library.

I only did some PHP/JavaScript programming long time ago and really need to learn myself some Python as well since you can use it these days in so many 3D related applications. I guess the steps though are about the same.

I must say the conversion to GLB/GLBF takes a really long time on even quite simple models when I tried it just from within the GUI so I would really use a separate machine. I also noticed the RAM usage can be really high, doesn’t have to be a problem but maybe try some models locally first before investing in a new server.

edit:

These are for example some ways to run through a directory using Python: How to iterate over files in directory using Python? - GeeksforGeeks

Hi Oscar, thank you a ton for your feedback which is very helpful!

Cheers, German

1 Like

Hello.
Every KeyShot version needs a separate Python installation. Then KeyShot will be startet with …\bin\keyshot_headless.exe -script and the path to the …\script.py.
As customer from INNEO you can contact me directly to get advice or use INNEO’s support team.

CheerEO
Marco

Hello @GermanNick and @oscar.rottink , It sounds like you may have a bit of knowledge around running scripts in Keyshot. Would you be able to help at all with the below query? Even if it is to tell me it cant be done?

https://community.keyshot.com/forum/t/how-to-automate-your-rendering-using-keyshot-scripting/707?u=hilary.comber